// 获取DOM元素
const daiban = document.getElementById('daiban');
const Notfinished = document.getElementById('Notfinished');
const finished = document.getElementById('finished');

// 添加待办事项的函数
function Add() {
    const daibanText = daiban.value.trim();
    if (daibanText) {
        const li = document.createElement('li');
        li.textContent = daibanText;

        // 添加删除按钮和标记为完成的按钮
        const deleteBtn = document.createElement('button');
        deleteBtn.textContent = '删除';
        deleteBtn.onclick = function () {
            Notfinished.removeChild(li);
        };

        const completeBtn = document.createElement('button');
        completeBtn.textContent = '完成';
        completeBtn.onclick = function () {
            finished.appendChild(li);
        };

        const notcompleteBtn = document.createElement('button');
        notcompleteBtn.textContent = '未完成';
        notcompleteBtn.onclick = function () {
            Notfinished.appendChild(li);
        };

        // 将按钮添加到列表中
        li.appendChild(deleteBtn);
        li.appendChild(completeBtn);
        li.appendChild(notcompleteBtn);

        // 将待办事项添加到列表中
        Notfinished.appendChild(li);

        // 清空输入框
        daiban.value = '';
    }
}


